# -*- makefile -*-
# Build script for kexec-mod
#
# Copyright (C) 2021 Fabian Mastenbroek.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

obj-m := kexec_mod.o
obj-m += arch/$(ARCH)/
kexec_mod-y := kexec_drv.o kexec_compat.o kexec.o

ccflags-y := -I$(src)/ -fno-unwind-tables -fno-asynchronous-unwind-tables

clean-dirs += orig

$(obj)/orig :
	mkdir -p $@

$(obj)/orig/% : | $(obj)/orig
	ln -sf $(KDIR)/kernel/$* $@

$(obj)/kexec.c : $(obj)/orig/kexec.c $(obj)/orig/kexec_core.c $(obj)/orig/kexec_internal.h

